﻿using boda.net.wpf.application.main.Views;
using boda.net.wpf.share.Prism;

using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;

namespace boda.net.wpf.application.main
{
    /// <summary>
    /// 模块依赖于菜单模块，由下往上依赖
    /// </summary>
    [Module(ModuleName = ModuleNames.ApplicationMainModule, OnDemand = true)]
    [ModuleDependency(ModuleNames.ApplicationMenuModule)]
    [ModuleDependency(ModuleNames.ApplicationTaskModule)]
    public class ApplicationMainModule : IModule
    {
        public void OnInitialized(IContainerProvider containerProvider)
        {
            // 2(3). 将窗体加载到主窗体的区域
            containerProvider.Resolve<IRegionManager>().RegisterViewWithRegion<MainView>(RegionNames.MainRegion);
        }

        public void RegisterTypes(IContainerRegistry containerRegistry)
        {
            // 1(3). 注册区域
            containerRegistry.RegisterForNavigation<MainView>();
        }
    }
}
